<template>
  <div class="centreLeft1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <i class="iconfont icon-tongji2" />
        </span>
        <div class="d-flex">
          <span class="fs-xxl text mx-2">{{active==0?'考试频次':'德育活动'}}</span>
          <dv-decoration-3 class="dv-dec-3" :color="datavColors"/>
          <el-tooltip
            class="box-item"
            effect="dark"
            :content="active == 0?'德育活动':'考试频次'"
            placement="top-start"
          >
            <img class="switchIcon" :src="switchIcon" alt="" @click="handleChange" />
          </el-tooltip>
        </div>
      </div>
      <div class="d-flex jc-center">
        <chart v-show="active == 0" />
        <chart1 v-show="active == 1" />
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent,computed,ref } from 'vue'
import { useStore } from 'vuex'
import Chart from "./chart/index";
import Chart1 from "./chart/educationIndex";
export default defineComponent({
  components: {
    Chart,
    Chart1
  },
  setup(){
    const datavColors = computed(() => useStore().state.datavColors)
    const switchIcon = require("@/assets/switch.png")
    const active = ref(0)
    const handleChange = () => {
      if(active.value == 0){
        active.value = 1
      }else{
        active.value = 0
      }
    }

    return{
      datavColors,
      active,
      switchIcon,
      handleChange
    }
  }
})
</script>

<style lang="scss" scoped>
$box-width: 100%;
$box-height: 300px;

.centreLeft1 {
  padding: 16px;
  height: $box-height;
  width: $box-width;
  border-radius: 10px;
  position: relative;
  .bg-color-black {
    height: $box-height - 30px;
    border-radius: 10px;
  }
  .text {
    color: #c3cbde;
  }
  .dv-dec-3 {
    position: relative;
    width: 100px;
    height: 20px;
    top: -3px;
  }

  .bottom-data {
    .item-box {
      & > div {
        padding-right: 5px;
      }
      font-size: 14px;
      float: right;
      position: relative;
      width: 50%;
      color: #d3d6dd;
      .dv-digital-flop {
        width: 120px;
        height: 30px;
      }
      i {
        font-size: 20px;
        line-height: 30px;
        margin-left: 20px;
      }
      .colorYellow {
        color: yellowgreen;
      }
      p {
        text-align: center;
      }
    }
  }
}
.switchIcon{
  width:18px;
  height:18px;
  position: absolute;
  right: 20px;
  cursor: pointer;
}
</style>
